<p class="small">
{foreach from=$games key=myId item=i name=gameT}
	{if $smarty.foreach.gameT.first}
		<table class="liste small">
			<caption>Mac Listesi</caption>
			<tr>
				<th>Tarih</th><th>Ev Sahibi</th><th colspan=2>Skor</th><th>Konuk</th><th>Pts</th><th></th>
			</tr>
	{/if}
	
	<tr>
	<form method="POST" action="games.php">
		<input type="hidden" name="game_id" value="{$i->id}" />
		<input type="hidden" name="id" value="{$i->prediction->id}" />
		<input type="hidden" name="action" value="pUpsert" />
		{if $my_session->gameDBTime >= $i->date}
			<td class="bodybg">{$i->date|date_format:"%d/%m/%Y %H:%M"}</td>
			<td class="bodybg">{$i->home_team->team}</td>
			<td class="bodybg">
				{$i->prediction->home_score}
			</td>
			<td class="bodybg">
				{$i->prediction->away_score}
			</td>
			<td class="bodybg">{$i->away_team->team}</td>
			<td class="bodybg">{$i->prediction->pts}</td>
			<td class="bodybg">
			</td>
		{else}
			<td>{$i->date|date_format:"%d/%m/%Y %H:%M"}</td>
			<td>{$i->home_team->team}</td>
			<td>
				<input type="text" name="home_score" value="{$i->prediction->home_score}" size="2"/>
			</td>
			<td>
				<input type="text" name="away_score" value="{$i->prediction->away_score}" size="2"/>
			</td>
			<td>{$i->away_team->team}</td>
			<td>{$i->prediction->pts}</td>
			<td>			
				{if $i->prediction->id != ""}
					<input type="Submit" value="Degistir" title="Degistir"/>
				{else}
					<input type="Submit" value="Ekle" title="Ekle"/>
				{/if}
			</td>
		{/if}
		
	</form>		
	</tr>
	{if $smarty.foreach.gameT.last}
		</table>
	{/if}
{/foreach}
</p>